﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace StockFinder.Model
{
    public class ApplicationConfiguation
    {
        private const string CONNECTION_STRING = "ConnectionString";
        private const string PRICEWITHINWINDOW = "PriceWithinWindow";
        private const string MINIBDRATING = "MinIBDRating";
        private const string SAVERESULTS = "SaveResults";
        private const string RESULTS_DIRECTORY = "ResultsDirectory";
        private const string OBJECT_DATABASES_ROOT_DIRECTORY = "ObjectDatabasesRootDirectory";
        private const string IBDRATINGSDIRECTORY = "IBDRATINGSDIRECTORY";
        private const string NORGATEPRICEHISTORYDIRECTORY = "NorgatePriceHistoryDirectory";

        public static string NorgatePriceHistoryDirectory
        {
            get
            {
                return ConfigurationManager.AppSettings[NORGATEPRICEHISTORYDIRECTORY];
            }
        }

        public static string IbdRatingsDirectory
        {
            get
            {
                return ConfigurationManager.AppSettings[IBDRATINGSDIRECTORY];
            }
        }

        public static string ObjectDatabaseSRootDirectory
        {
            get
            {
                return ConfigurationManager.AppSettings[OBJECT_DATABASES_ROOT_DIRECTORY];
            }
        }
        
        public static string ResultsDirectory
        {
            get
            {
                return ConfigurationManager.AppSettings[RESULTS_DIRECTORY];
            }
        }

        public static string DatabaseConnectionString
        {
            get
            {
                return ConfigurationManager.AppSettings[CONNECTION_STRING];
            }
        }

        public static decimal PriceWithinWindow 
        { 
            get
            {
                return Convert.ToDecimal(ConfigurationManager.AppSettings[PRICEWITHINWINDOW]);     
            }
        }

        public static int MinIBDRating
        {
            get
            {
                return Convert.ToInt32(ConfigurationManager.AppSettings[MINIBDRATING]);
            }
        }

        public static bool SaveResults
        {
            get
            {
                return Convert.ToBoolean(ConfigurationManager.AppSettings[SAVERESULTS]);
            }
        }
    }
}
